package cn.zyq.ykb.beans.user;

import cn.zyq.ykb.beans.config.ConfigTaskType;
import cn.zyq.ykb.beans.task.Task;
import cn.zyq.ykb.system.annotation.Excel;
import cn.zyq.ykb.system.common.BaseBean;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 用户-余额变更对象 userbalance
 *
 * @author SystemAuth
 * @date 2023-05-19
 */
@Data
@Entity
@Table(name = "`userBalance`")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class UserBalance extends BaseBean implements Serializable {
    /**
     * 主键id，用于关联
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "JDBC")
    @Column(name = "`userBalanceID`")
    @ApiModelProperty("主键id，用于关联")
    private Integer userBalanceID;
    /**
     * 用户ID
     */
    @Column(name = "`userID`")
    @ApiModelProperty("用户ID")
    private Integer userID;
    /**
     * 当前余额
     */
    @Column(name = "`currentBalance`")
    @ApiModelProperty("当前余额")
    private BigDecimal currentBalance;
    /**
     * 上次余额
     */
    @Column(name = "`lastBalance`")
    @ApiModelProperty("上次余额")
    private BigDecimal lastBalance;
    /**
     * 变更余额(正为增加 ，负为减少)
     */
    @Column(name = "`changeBalance`")
    @ApiModelProperty("变更余额(正为增加 ，负为减少)")
    private BigDecimal changeBalance;
    /**
     * 任务ID
     */
    @Column(name = "`associationID`")
    @ApiModelProperty("关联ID")
    private Integer associationID;
    /**
     * 类型（1.直推，2.自做单）
     */
    @Column(name = "`status`")
    @ApiModelProperty("类型（1自做单,2好友做单,3提现,4项目外放）")
    private Integer status;
    /**
     * 来源用户
     */
    @Column(name = "`sourceUserID`")
    @ApiModelProperty("来源用户")
    private Integer sourceUserID;
    /**
     * 变更原因
     */
    @Column(name = "`changeTitle`")
    @ApiModelProperty("变更原因")
    private String changeTitle;
    /**
     * 用户名
     */
    @Column(name = "`nickName`")
    @ApiModelProperty("用户名")
    @Excel(name = "用户")
    private  String nickName;
    /**
     * 用户名
     */
    @Column(name = "`avatar`")
    @ApiModelProperty("头像")
    @Excel(name = "头像")
    private  String avatar;
    /**
     * 用户名
     */
    @Column(name = "`position`")
    @ApiModelProperty("角色")
    @Excel(name = "角色")
    private  Integer position;

    @Transient
    @ApiModelProperty("任务表数据")
    private Task task;

    @Transient
    @ApiModelProperty("任务类型数据")
    private ConfigTaskType configTaskType;



    @Transient
    @ApiModelProperty("任务类型数据")
    private User user;

    public UserBalance(){}

    /**
     *
     * @param userID  用户ID
     * @param currentBalance 当前余额
     * @param lastBalance  上次余额
     * @param changeBalance  变更余额
     * @param associationID  关联ID
     * @param status       （1.自做单,2.好友做单,3提现）
     * @param sourceUserID 来源用户
     * @param changeTitle   变更原因
     */
    public UserBalance(Integer userID,BigDecimal currentBalance,BigDecimal lastBalance, BigDecimal changeBalance,
                Integer associationID,Integer status,Integer sourceUserID,String changeTitle){
        this.userID = userID;
        this.currentBalance = currentBalance;
        this.lastBalance = lastBalance;
        this.changeBalance = changeBalance;
        this.associationID = associationID;
        this.status = status;
        this.sourceUserID = sourceUserID;
        this.changeTitle = changeTitle;
    }
}
